

import 'package:flutter/cupertino.dart';
import 'package:furaha_mkopo/commonTool/fm_color_tool.dart';
import 'package:furaha_mkopo/commonTool/fm_screen_tool.dart';
import 'package:furaha_mkopo/page/home/orderDetail/emergency/fm_emergency_sub_widget.dart';

class FMEmergencyWidget extends StatefulWidget {

  String title;
  String relationTitle;
  String relationContent;
  String relationPlaceHolder;
  String phoneTitle;
  String phoneContent;
  String phonePlaceHolder;

  GestureTapCallback? relationOnTap;
  GestureTapCallback? phoneOnTap;

  FMEmergencyWidget({
    super.key,
    required this.title,
    required this.relationTitle,
    required this.relationContent,
    required this.relationPlaceHolder,
    required this.phoneTitle,
    required this.phoneContent,
    required this.phonePlaceHolder,
    this.relationOnTap,
    this.phoneOnTap
  });

  @override
  State<FMEmergencyWidget> createState() => _FMEmergencyWidgetState();
}

class _FMEmergencyWidgetState extends State<FMEmergencyWidget> {


  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: FMScreenTool.width(context) - 56,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          _titleWidget(),
          const SizedBox(height: 10),
          _relationShipWidget(),
          const SizedBox(height: 12),
          _phoneWidget(),
        ],
      ),
    );
  }

  Widget _titleWidget() {
    return Text(
      widget.title,
      style: TextStyle(
        fontSize: 16,
        fontWeight: FontWeight.w600,
        color: FMColorTool.blackColor
      ),
    );
  }

  Widget _relationShipWidget() {
    return FMEmergencySubWidget(
      title: widget.relationTitle,
      content:widget.relationContent,
      placeHolder:widget.relationPlaceHolder,
      isClicked: true,
      onTap: widget.relationOnTap,
    );
  }

  Widget _phoneWidget() {
    return FMEmergencySubWidget(
        title:widget.phoneTitle,
        content:widget.phoneContent,
        placeHolder:widget.phonePlaceHolder,
        isClicked: true,
        onTap: widget.phoneOnTap,
    );
  }


}
